//
//  TCbarViewController.m
//  susencloud
//
//  Created by tanchao on 15/11/9.
//  Copyright © 2015年 chaoren. All rights reserved.
//

#import "TCbarViewController.h"
#import "SCViewController.h"
#import "WJViewController.h"
#import "CSViewController.h"
#import "WOViewController.h"
@interface TCbarViewController ()

@end

@implementation TCbarViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    [self addViewController];
    // Do any additional setup after loading the view.
}
#pragma  mark 添加tabBar
-(void)addViewController{
    self.tabBar.opaque = YES;
    UIColor *yagcolor =    [UIColor blueColor];
    UIFont* font = [UIFont fontWithName:@"Arial-ItalicMT" size:11.0];
    NSDictionary* textAttributesSel = @{NSFontAttributeName:font,NSForegroundColorAttributeName:yagcolor};
    
    [[UITabBarItem appearance] setTitleTextAttributes:textAttributesSel forState:UIControlStateSelected];
    
    SCViewController *scVC = [[SCViewController alloc]init];
    [self addChildViewController:scVC title:@"收藏" imageName:@"收藏"];
    WJViewController *wjVC = [[WJViewController alloc]init];
    [self addChildViewController:wjVC title:@"文件" imageName:@"文件"];
    CSViewController *csVC = [[CSViewController alloc]init];
    [self addChildViewController:csVC title:@"传输" imageName:@"传输"];
    WOViewController *woVC = [[WOViewController alloc]init];
    [self addChildViewController:woVC title:@"我" imageName:@"我"];
    
}

//-(void)addChildViewController:(UIViewController *)childController imageName:(NSString *)imageName{
//    NSString *selectedImage = [imageName stringByAppendingString:@"_highlighted"];
//    childController.tabBarItem.selectedImage =[[UIImage imageNamed:selectedImage] imageWithRenderingMode:UIImageRenderingModeAlwaysOriginal];
//    
//    childController.tabBarItem.image=[[UIImage imageNamed:imageName]  imageWithRenderingMode:UIImageRenderingModeAlwaysOriginal];
//    OVNavViewController *nav = [[OVNavViewController alloc]initWithRootViewController:childController];
//    nav.navigationBar.barStyle = UIBarStyleBlackTranslucent;
//    [self addChildViewController:nav];
//}

/**
 *  添加childController
 */
- (void)addChildViewController:(UIViewController *)childController title:(NSString *)title imageName:(NSString *)imageName{
    childController.tabBarItem.title = title;
    NSString *selectedImage = [imageName stringByAppendingString:@"-选中"];
    childController.tabBarItem.selectedImage =[[UIImage imageNamed:selectedImage] imageWithRenderingMode:UIImageRenderingModeAlwaysOriginal];
    NSString *imageof = [imageName stringByAppendingString:@"-未选中"];
    childController.tabBarItem.image=[[UIImage imageNamed:imageof]  imageWithRenderingMode:UIImageRenderingModeAlwaysOriginal];
    [childController.view setBackgroundColor:[UIColor whiteColor]];
    UINavigationController *nav = [[UINavigationController alloc]initWithRootViewController:childController];
    nav.navigationBar.titleTextAttributes = [NSDictionary dictionaryWithObject:[UIColor yellowColor] forKey:UITextAttributeTextColor];
    [nav.navigationBar setBarTintColor:[UIColor blueColor]];
    [self addChildViewController:nav];
}
- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/

@end
